/* 路由 */
import Vue from 'vue'
import VueRouter from 'vue-router'
import {asyncRouteMap} from './router.config';
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
/* 进度环隐藏 */
NProgress.configure({showSpinner: false});

Vue.use(VueRouter)
const router = new VueRouter({
  mode: 'history',
  base: '/',
  routes: asyncRouteMap
})

router.beforeEach((to, from, next) => {
  NProgress.start()
  // console.log(to, from, '路由拦截');
  next()
})
router.afterEach(() => {
  // console.log('路由之后拦截');
  NProgress.done()
})

export default router